#include<bits/stdc++.h>
using namespace std;
int a[1000000];
int main()
{   
    freopen("arena.in","r",stdin);
    freopen("arena.out","w",stdout);
    int b;
    cin >> b;
    for(int i = 1;i <= b;i++)
    {
        cin >> a[i];
    }
    int s = 0,y = 0;
    for(int i = 1;i <= b;i++)
    {
        if(a[i]==2)
        {
            s++;
        }
        if(a[i] == 1)
        {
            y++;
        }

    }

    if(s == y)
        {
            cout << 0;
        }
        else if(s > y)
        {
            cout << s;
        }
        else
        {
            cout << y;
        }
    return 0;
}